package ms.unicorn.diagram.providers;

import java.util.LinkedList;
import java.util.List;

import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.gmf.runtime.common.core.command.AbstractCommand;
import org.eclipse.gmf.runtime.common.core.command.CommandResult;

public class UnicornEditorCopyCommand extends AbstractCommand {

	public static List CopiedObjects;
	private List toCopyObjects;
	
	public UnicornEditorCopyCommand(String label, List toCopyElements, List toCopyEditParts) {
		super(label);
		this.toCopyObjects = toCopyElements;
	}

	@Override
	protected CommandResult doExecuteWithResult(
			IProgressMonitor progressMonitor, IAdaptable info)
			throws ExecutionException {
		CopiedObjects = new LinkedList(EcoreUtil.copyAll(toCopyObjects));
		// TODO: CopyCommand, check consistency in copied objects
		return CommandResult.newOKCommandResult();
	}

	@Override
	protected CommandResult doRedoWithResult(IProgressMonitor progressMonitor,
			IAdaptable info) throws ExecutionException {
		return null;
	}

	@Override
	protected CommandResult doUndoWithResult(IProgressMonitor progressMonitor,
			IAdaptable info) throws ExecutionException {
		return null;
	}

}
